package com.homedo.odin.solution.controller.pc;

import com.homedo.core.common.base.controller.BaseController;
import com.homedo.core.common.base.dto.Meta;
import com.homedo.core.common.base.dto.ResultData;
import com.homedo.odin.solution.contract.pc.PcHotKeywordListResp;
import com.homedo.odin.solution.contract.pc.TopBountysResp;
import com.homedo.odin.solution.service.HotKeywordServiceImpl;
import com.homedo.odin.solution.service.bizservice.home.HomeBizService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: donglibing
 * @date: 2018/3/6 14:39
 * @Description:
 */
@Api(description = "首页", tags = {"Home"}, produces = MediaType.APPLICATION_JSON_VALUE)
@RestController
@RequestMapping("/home")
public class HomeController extends BaseController<HomeBizService> {

    @Autowired
    HotKeywordServiceImpl hotKeywordService;


    @ApiOperation(value = "PC_获取关键词热搜列表", notes = "PC_获取搜索热词", response = PcHotKeywordListResp.class, httpMethod = "GET")
    @GetMapping("/hotwords/{top}")
    public ResultData getHotKeywords(@PathVariable("top") int top) {
        PcHotKeywordListResp resp = hotKeywordService.queryPcHotKeywords(top);
        return ResultData.newInstance(Meta.CODE_200, resp);
    }

    @ApiOperation(value = "获取每日悬赏", notes = "获取每日悬赏", response = TopBountysResp.class, httpMethod = "GET")
    @GetMapping("/topbountys/{top}")
    public ResultData topBountys(@PathVariable("top") int top) {
        TopBountysResp resp = baseService.topbountys(top);
        return ResultData.newInstance(Meta.CODE_200, resp);
    }
}
